<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><?php echo $view->title;?></title>
		
		<!-- Define CSS stylesheets -->
		<link rel="stylesheet" href="_jslib/jquery/themes/base/jquery.ui.all.css">
		<link rel="stylesheet" type="text/css" href="_styles/css/bootstrap/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="_styles/css/bootstrap/cus-icons.css">
		<link rel="stylesheet" type="text/css" href="_styles/css/navmenu.css">
		<link rel="stylesheet" type="text/css" href="_styles/css/main.css">
		<link rel="stylesheet" type="text/css" href="_styles/css/template.css">
		
		<!-- Define Javascript Libraries -->
		<script type="text/javascript" src="_jslib/jquery/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery-ui.js"></script>  
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.core.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.mouse.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.button.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.draggable.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.position.js"></script>
    <script type="text/javascript" src="_jslib/jquery/ui/jquery.ui.dialog.js"></script>
    <script type="text/javascript" src="_jslib/jquery/watermark/jquery.watermark.js"></script>
		<script type="text/javascript" src="_jslib/bootstrap/bootstrap-hover-dropdown.min.js"></script> 
		<script type="text/javascript" src="_jslib/bootstrap/bootstrap.min.js"></script> 
		<script type="text/javascript" src="_jslib/main.js"></script>
		
    <script type="text/javascript">
			$(document).ready(function() {
          $("#keyword").watermark("Enter your keyword");
			    setInterval("formDateTimeStr()", 1000);

          $("#pagelinks").change(function() {
            var url      = $("#page_url").val();
            var pagenum      = $('#pagelinks :selected').val();
            var redirect_url = "<?=APP_ROOT?>/"+url+"&page="+pagenum;
            window.location.replace(redirect_url);
          });

          $("#reset").click(function() {
            resetFormFields("searchForm");
            var url = location.href;
            window.location.replace(url);
          });
			});
		</script>
	</head>

	<?php
		$classDisabled = "";
		if($_SESSION['account']['user_type_id'] != CONST_SUPER_ADMIN_TYPE){
			$classDisabled = "disabled";
		}

    $moduleArr = explode("-", $_REQUEST['mod']);
    $module    = $moduleArr[0];
	?>

	<body>
		<!-- template html here -->
		<nav class="navbar navbar-default" role="navigation"> 
			<div  class="navbar-header">
   				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
    			<a class="navbar-brand" href="<?=APP_ROOT?>/home">Gemba360 GP Clinic</a> 
    	</div>
    	<div id="main_header">
    		  Logged in as 
  				<?php
  					if($_SESSION['account']['user_type_id'] != CONST_SUPER_ADMIN_TYPE){
  						echo ($_SESSION['account']['is_practicioner'] == 1) ? $_SESSION['account']['practicioner_name'] : $_SESSION['account']['nonpracticioner_name'];
  					}else{
  						echo $_SESSION['account']['username'];
  					}
  				?>
    	</div>
      <br clear="all" />
      
			<div class="collapse navbar-collapse navbar-ex1-collapse">
        <ul class="nav navbar-nav">
            <li> <a href="<?=APP_ROOT?>/home">Home</a> </li>
            <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">File<b class="caret"></b></a>
			        <ul class="dropdown-menu">
				        <li><a href="<?=APP_ROOT?>/coming-soon">Open</a></li>
				        <li><a href="<?=APP_ROOT?>/coming-soon">Address Book</a></li>
				        <li> <a href="<?=APP_ROOT?>/coming-soon">Pathology</a></li>
                <li> <a href="<?=APP_ROOT?>/coming-soon">Print</a></li>
                <li> <a href="<?=APP_ROOT?>/coming-soon">Mail Merge</a> </li>
                <li> <a href="<?=APP_ROOT?>/coming-soon">Print Labels</a></li>
                 <li class="divider"></li>
                <li> <a href="<?=APP_ROOT?>">Close</a></li>
			        </ul>
    				</li>
            <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">Edit<b class="caret"></b></a>
              <ul class="dropdown-menu">
                <?if(!empty($_SESSION['account']['allow_add'])) { ?>
                  <li><a href="javascript:void(0)" onClick="openEditDialog('<?=$add?>')">New</a></li>
                <? } else {?>
                  <li class="disabled">New</li>
                <? } ?>

                <?if(!empty($_SESSION['account']['allow_edit'])) { ?>
                  <li><a href="javascript:void(0)" onClick="navigationLink('edit')">Edit</a></li>
                <? } else {?>
                  <li class="disabled">Edit</li>
                <? } ?>

                <?if(!empty($_SESSION['account']['allow_delete'])) { ?>
                  <li><a href="javascript:void(0)" onClick="navigationLink('delete')">Delete</a></li>
                 <? } else {?>
                  <li class="disabled">Delete</li>
                <? } ?>

                <?if($module == "patient"){ ?>
                  <li><a href="<?=APP_ROOT?>/coming-soon">Jump</a></li>
                  <li><a href="<?=APP_ROOT?>/coming-soon">Merge</a></li>
                <? } ?>
              </ul>
            </li>

            <?if($module == "patient"){ ?>
              <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">View<b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="<?=APP_ROOT?>/<?=$module?>&status=1">Current Patients</a></li>
                  <li><a href="<?=APP_ROOT?>/<?=$module?>&status=2">Deceased Patients</a></li>
                  <li><a href="<?=APP_ROOT?>/<?=$module?>&status=0">Inactive Patients</a></li>
                  <li class="divider"></li>
                  <li> <a href="<?=APP_ROOT?>/<?=$module?>&o=lname">Sort by Name</a></li>
                  <li><a href="<?=APP_ROOT?>/<?=$module?>&o=address1">Sort by Address</a></li>
                  <li><a href="<?=APP_ROOT?>/<?=$module?>&o=chart_no">Sort by Chart No.</a></li>
                </ul>
              </li>
            <? } ?>
            
            <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">Help<b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="<?=APP_ROOT?>/coming-soon">Index</a></li>
                <li><a href="<?=APP_ROOT?>/coming-soon">About</a></li>
              </ul>
            </li>
  			</ul>
 			</div>
		</nav>

		<div id="content">
      <p id="edit_nav_params" style="display:none;"></p>
      <p id="delete_nav_params" style="display:none;"></p>
			<?php include($view->page); ?>
		</div>

    <!-- Dialog box pop-ups -->
    <div id="deleteDiv" title="Are you sure you want to delete this?" style="display:none;">
        <iframe id="delete" width="350" height="80"></iframe>
    </div>

	</body>
</html>